﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UnFixedWorkInput.aspx.cs" Inherits="Basic4Net.OAWeb.Module_Workload.UnFixedWorkInput" %>


<%@ Register Assembly="Controls" Namespace="Basic4Net.Controls" TagPrefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <link type="text/css" rel="stylesheet" href="../App_Themes/ui-lightness/main.css" />
    <script type="text/javascript" src="../Scripts/jquery-1.4.1.js"></script>
    <script type="text/javascript" src="../Scripts/Common.js"></script>   
    <script>
        var re = /^[0-9]+.?[0-9]*$/; //验证正数
        var delArr = new Array();

        //---------------------------------------------------------------------------------其他 



        //编辑状态
        function modi(obj) {

            if (obj.readOnly == true) {
                //   obj.parentElement.style.textAlign = 'center';
                obj.style.textAlign = 'left';
                obj.style.border = 'solid #a5a5a5 1px;';
                obj.readOnly = false;
                obj.select();
                updateActivate = 1;
            }
        }


        //非编辑状态
        function unModi(obj, align) {
            if (obj.readOnly == false) {
                obj.parentElement.style.textAlign = align;
                obj.style.textAlign = align;
                obj.style.border = 'solid #ffffff 1px;';
                obj.readOnly = true;
                updateActivate = 0;
            }
        }


        //选中行高亮
        function SetHightLight(obj) {
            if (obj != null)
                obj.style.backgroundColor = "#fffccf";

            var table = document.getElementById('table');
            for (var i = 0; i < table.rows.length; i++) {
                var row = table.rows[i];
                if (row != null && row.rowIndex != obj.rowIndex) {
                    row.style.backgroundColor = "#ffffff";
                }
            }
        }


        function FilterCount() {
            var value = event.srcElement.value;
            var table = document.getElementById('table');
            var rowIndex = event.srcElement.parentElement.parentElement.rowIndex;
            var row = table.rows[rowIndex];
            if (value == 1) {
                row.cells[2].all[0].style.display = "none";
                //    row.cells[3].all[0].style.display = "none"; 
            }
            else {
                row.cells[2].all[0].style.display = "block";
                //    row.cells[3].all[0].style.display  = "block"; 
            }
        }


        function optionSettingScore(obj) {
            unModi(obj, 'right');
            var id = obj.parentElement.parentElement.getAttribute("itemid");
            var value = obj.value;
            var oldValue = obj.oldvalue;
            if (value == null || value.length <= 0 || Number(value) == Number(oldValue))
                return;

            if (value.search(/^(-|\+)?\d+(\.\d+)?$/) == -1) {

                if (value.length > 0 && value.charAt(value.length - 1) == ".") {
                    value = value.substr(0, value.length - 1);
                    if (value.search(/^(-|\+)?\d+(\.\d+)?$/) == -1) {
                        obj.setAttribute("value", obj.getAttribute("oldvalue"));
                        return;
                    }
                    else {
                        if (CheckCh(value)) {
                            obj.setAttribute("value", value);
                            obj.setAttribute("oldvalue", value);
                        }
                        else {
                            obj.setAttribute("oldvalue", value);
                        }
                    }
                }
                else {
                    if (value.length == 0 || (/\D/.test(value))) {
                        obj.setAttribute("value", obj.getAttribute("oldvalue"));
                        return;
                    }
                    else {
                        obj.setAttribute("value", value);
                        obj.setAttribute("oldvalue", value);
                    }
                }
            }
            else {
                obj.setAttribute("oldvalue", value);
            }

            var listId = obj.parentElement.parentElement.listId;
            if (listId == null || listId.length == 0 || listId <= 0)
                listId = 0;
            var workId = obj.getAttribute("workid");
            SetTeachWorkNum(listId, workId, id, value); 
        }

        function SetTeachWorkNum(listId, workId, teacherId, workNum) { 
            if (workNum == null || workNum <= 0 || teacherId == null || teacherId <= 0 || workNum == null || workNum <= 0)
                return;

            PageMethods.SetTeachWorkNum(listId, workId, teacherId, workNum,function (succ) {
                if (succ > 0) {
                    Bind();
                }
            }, function (err) {
                showMassgeBox("提示", "操作失败", 1, null);
            });
        }


        function UpdateTeachWorkNum(listId,workNum) {
            if (listId == null || listId <= 0 || workNum == null || workNum <= 0)
                return;
            PageMethods.UpdateTeachWorkNum(listId, workNum, function (succ) {
                if (succ > 0) {
                    Bind();
                }
            }, function (err) {
                showMassgeBox("提示", "添加失败", 1, null);
            });

        }


        function AddTeachWorkNum(teacherId, workId, workNum) {
            PageMethods.AddTeachWorkNum(teacherId, workId, workNum, function (succ) {
                if (succ > 0)
                    Bind();
            }, function (err) {
                showMassgeBox("提示", "添加失败", 1, null);
            });
        }

        function Bind() {
            var teachCode = document.getElementById('txtTeachCode').value;
            document.getElementById('TeachCode').value = teachCode;

            document.getElementById('btnItemBind').click();
        }
    </script>
</head>
<body  onload="myload();">
    <form id="form1" runat="server">
   <div style="overflow-y: auto; overflow-x: none; height: 98%;">
            <div class="mainWarp">
                <div class="pageBody" style="height: 96%;">
                    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
                    </asp:ScriptManager>  
                        
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                   <h3><label id="lblTitle">以下是对<% =CurrentYear %>学年 <% =CurrentMonth %> 月份教工不固定工作量录入</label></h3>

                        <ul class="butList">
                            <li>
                                <asp:DropDownList ID="dropList1" runat="server" OnSelectedIndexChanged="DrPostChanged" AutoPostBack="True">
                                    
                                </asp:DropDownList> 
                            </li>
                             <li>
                                输入姓名或工号：<input id="txtTeachCode" type="text" /><%--姓名:<input id="txtTeachName" type="text" />--%>
                             </li>
                            <li>
                                <input type="button" value="查询" class="commonBut" id="btnAddItem" onclick="Bind();" />
                            </li> 
                        </ul>  
                                
                        <div style="overflow-y: auto; overflow-x: none; height: 90%;">
                            <table id="table" class="useList" style="width: 95%">
                             <asp:Repeater ID="Repeater1" runat="server">    
                             <HeaderTemplate>
                                <tr >
                                    <th style="text-align: left; padding-left: 5px;width: 10%">
                                        职称</th>
                                    <th style="text-align: left; padding-left: 5px;width: 10%">
                                        工号</th> 
                                    <th style="text-align: left; padding-left: 5px;width: 10%">
                                        姓名</th>
                                    <th style="text-align: left; padding-left: 5px;">
                                        性别</th>
                                   <th style="text-align: left; padding-left: 5px;width: 20%">
                                        出生日期</th>
                                    <%# GetHeadInfo() %>
                                </tr>
                            </HeaderTemplate>
                            <ItemTemplate> 
                                <tr itemid="<%# Eval("TeacherID")%>"  
                                                    onclick="SetHightLight(this);" >
                                    <td style="text-align: left; padding-left: 5px;"><%# Eval("PostName")%></td>
                                    <td style="text-align: left; padding-left: 5px;"><%# Eval("TeachCode")%></td>
                                    <td style="text-align: left; padding-left: 5px;"><%# Eval("TeachName")%></td>
                                    <td style="text-align: left; padding-left: 5px;"><%# Eval("Sexy")%></td>
                                    <td style="text-align: left; padding-left: 5px;"><%# Eval("BirthDay")%></td>
                                    <%# GetTdInfo((int)Eval("TeacherID"))%>
                                     </tr> 
                            </ItemTemplate>
                            </asp:Repeater> 
                        </table> 
                        </div>  
                     <div style=" text-align:left; padding-top:8px;">
                            <webdiyer:BNPager ID="aspNetPager" runat="server" PageSize="15" Width=680
                             OnPageChanged="AspNetPagerPageChanged"    ShowPageIndex="true">
                            </webdiyer:BNPager>
                         </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnItemBind" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="aspNetPager" EventName="PageChanged" />
                </Triggers>
            </asp:UpdatePanel>

            <%--服务器端控件层--%>
            <div style="display:none;">
                <asp:Button runat="server" ID="btnItemBind" onclick="btnItemBind_Click"   />
                <asp:TextBox runat="server" ID="TeachName" />
                <asp:TextBox runat="server" ID="TeachCode" /> 
            </div>
                  
               
            </div>
        </form>
    
</body>
</html>
<script type="text/javascript">
    function myload() {
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(EndRequestHandler);
    }
    function EndRequestHandler() {
        $("input[type='submit']").addClass("commonBut");
    }

    $("input[type='submit']").addClass("commonBut");
</script>